package com.shen.cloud.service;

import com.shen.cloud.pojo.Department;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;

import java.util.List;


@FeignClient(value = "SPRINGCLOUD-EUREKA-CLIENT-PRO-8001",fallbackFactory = DeptClientServiceFallbackFactory.class)
//value=服务名   fallbackFactory=降级后处理的类
public interface DepartmentClientService {
    /**
     * 这里路径要和服务提供端controller的路径一致不然访问不到
     * @param department
     * @return
     */

    /*增加一个部门*/
    @PostMapping("/dept/add")
    boolean insertDepartment(Department department);
    /*根据id查询一个部门*/
    @GetMapping("/dept/get/{id}")
    Department selectDepartmentById(@PathVariable("id") Long id);
    /*查询所有部门*/
    @GetMapping("/dept/list")
    List<Department> selectAllDepartment();
}
